<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/4/11
 * Time: 15:14
 */

namespace app\common\model;


use traits\model\SoftDelete;

class Dynamic extends BaseModel
{
    use SoftDelete;
    protected $updateTime = false;
    protected $deleteTime = 'deleted_at';

    public function getImagesAttr($value){
        return explode(',',$value);
    }
    //protected
    public function user()
    {
        return $this->belongsTo('User','user_id','id')->field('id,nickname,avatar,education');
    }

    public function comment(){
        return $this->hasMany('DynamicComment','d_id','id')->order('created_at','asc')->page(1,2);
    }
}